﻿using Lis.IBLL;
using Lis.IRepository;
using Lis.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lis.BLL
{
    public class UserCirculateService : BaseService<UserCirculate>,IUserCirculateService
    {
        #region 01，添加+override bool Add(UserCirculate entity)
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public override bool Add(UserCirculate entity)
        {
            return DBSession.SysUserCirculateRepository.Add(entity);
        }
        #endregion

        #region 02，更新+override bool UpDate(UserCirculate entity)
        // <summary>
        /// 更新
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public override bool UpDate(UserCirculate entity)
        {
            return DBSession.SysUserCirculateRepository.Update(entity);
        }
        #endregion

        #region 03，实体对象+override bool Delete(UserCirculate entity)
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public override bool Delete(UserCirculate entity)
        {
            return DBSession.SysUserCirculateRepository.Delete(entity);
        } 
        #endregion

        #region 04,分页查询+override IQueryable<UserCirculate> GetPageEntities<S>(int pageSize, int pageIndex, out int total, bool isAsc, System.Linq.Expressions.Expression<Func<UserCirculate, bool>> whereLambda, System.Linq.Expressions.Expression<Func<UserCirculate, S>> orderByLambda)
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <typeparam name="S"></typeparam>
        /// <param name="pageSize">页大小</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="total">总条数</param>
        /// <param name="isAsc">是否倒序</param>
        /// <param name="whereLambda">查询lambda</param>
        /// <param name="orderByLambda">排序lambda</param>
        /// <returns></returns>
        public override IQueryable<UserCirculate> GetPageEntities<S>(int pageSize, int pageIndex, out int total, bool isAsc, System.Linq.Expressions.Expression<Func<UserCirculate, bool>> whereLambda, System.Linq.Expressions.Expression<Func<UserCirculate, S>> orderByLambda)
        {
            return DBSession.SysUserCirculateRepository.GetPageEntities<S>(pageSize, pageIndex, out total, isAsc, whereLambda, orderByLambda);
        } 
        #endregion
        #region 05，根据读者类型和馆藏地查询读者流通权限+IEnumerable<UserCirculate> GetEntitiesByUserType(string userType, string collectionCode)
        /// <summary>
        /// 根据读者类型和馆藏地查询读者流通权限
        /// </summary>
        /// <param name="userType">读者类型</param>
        /// <param name="collectionCode">馆藏地</param>
        /// <returns></returns>
        public IEnumerable<UserCirculate> GetEntitiesByUserType(string userType, string collectionCode)
        {
            return ((IUserCirculateRepository)DBSession.SysUserCirculateRepository).GetEntitiesByUserType(userType, collectionCode);
        } 
        #endregion
        #region 06，根据读者类型查询流通权限信息+IEnumerable<UserCirculate> GetEntitiesByUserType(string userType)
        /// <summary>
        /// 根据读者类型查询流通权限信息
        /// </summary>
        /// <param name="userType">读者类型</param>
        /// <returns></returns>
        public IEnumerable<UserCirculate> GetEntitiesByUserType(string userType)
        {
            return ((IUserCirculateRepository)DBSession.SysUserCirculateRepository).GetEntitiesByUserType(userType);
        } 
        #endregion
    }
}
